<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$info = pdo_get('zh_gjw_dbcate',array('id'=>$_GPC['id']));
if(checksubmit('submit')){
        $data['cate']=$_GPC['cate'];
        $data['sort']=$_GPC['sort'];
        $data['p_id']=$_GPC['p_id'];
        $data['img']=$_GPC['img'];
        $data['showhide']=$_GPC['showhide'];
        $data['uniacid']=$_W['uniacid'];
        if (empty($_GPC['cate'])) {
             message('分类名不能为空','','error');
        }
        if($_GPC['id']==''){  
            $rst=pdo_insert('zh_gjw_dbcate',$data);      
            if($rst){
                 message('添加成功！', $this->createWebUrl('dbcate'), 'success');
            }else{
                 message('添加失败！','','error');
            }
        }else{
             $rst=pdo_update('zh_gjw_dbcate',$data,array('id'=>$_GPC['id']));
            if($rst){
                 message('编辑成功！', $this->createWebUrl('dbcate'), 'success');
            }else{
                 message('编辑失败！','','error');
            }
        }
}
include $this->template('web/adddbcate');